home *** CD-ROM | disk | FTP | other *** search
- Path: aargh.incubus.sub.org!marc
- From: marc@aargh.incubus.sub.org (Marc 'Nepomuk' Heuler)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Serial Device -> ReadLine ?
- Message-ID: <F2yUx*rha@aargh.incubus.sub.org>
- Date: Sat, 06 Jan 1996 11:40:25 CET
- Reply-To: marc@aargh.incubus.sub.org
- References: <flohoff.0660@dataland.owl.de>
- Organization: Data Design
- X-Newsreader: Arn V1.03a
-
- In article <flohoff.0660@dataland.owl.de>, Florian Lohoff writes:
-
- > i want a routine which sends me (In best case) every time a ExecMsg when
- > received a full line from the serial device. What is the best way to do this.
- >
- > My thought.
- >
- > 1. Read only one char at a time. Put it sequentially in a buffer until $0a/$0d
- > 2. Use EOFMode. As i understand from AutoDocs the eofmode made Interrupt
- > receiving. I wasn`t able to get this to run.
-
- EOF mode is bad since it is not supported by all serial expansion boards
- (at least the A2232 and GVP-IO with old driver software).
-
- You could spawn a child task for serial communication:
-
- The child task SDCMD_QUERYs the port for data. If no data is available,
- the task CMD_READs 1 byte. Otherwise it reads that many bytes that are
- available.
-
- The task reads to a circular buffer of x bytes length. X should be the
- number of bytes that can appear in one line maximum, plus a large safety
- margin for line noise. A dropped (internal serial port!) EOL character for
- example can double the line size. Do check the size before reading!
-
- After a read has completed, the task should scan the circular buffer for an
- EOL character. If it finds one, it sends copies the line to an exec
- message and sends it to your main task - and marks that part of the buffer
- as free.
-
- If the buffer overflows (no more free bytes, but no EOL char inside), it
- must be cleared, paying data loss to prevent hangs.
-
- The child task should respond to ^C by cleaning up and exiting.
-